#include "room_item.h"
#include "ui_room_item.h"

room_item::room_item(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::room_item)
{
    ui->setupUi(this);
}

room_item::~room_item()
{
    delete ui;
}

void room_item::setInfo(uint16_t id, QString str)
{
    ui->label_id->setText(QString::number(id));
    ui->label_name->setText(str);

    QString list_style[5] = {
        "#horizontalLayoutWidget{border-radius: 10px;background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, stop:0.248756 #ff8159, stop:1 #ff937e);}",
        "#horizontalLayoutWidget{border-radius: 10px;background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, stop:0.248756 #7e7efa, stop:1 #b094fe);}",
        "#horizontalLayoutWidget{border-radius: 10px;background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, stop:0.248756 #3a94f5, stop:1 #57bcf7);}",
        "#horizontalLayoutWidget{border-radius: 10px;background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, stop:0.248756 #08b3d0, stop:1 #01d5be);}",
    };

    ui->label_img->setStyleSheet("image: url(:/images/user/"+QString::number(id%7)+".png);");
    this->ui->horizontalLayoutWidget->setStyleSheet(list_style[id%4]);
}

